<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>JSDoc: Class: BlockPyEditor</title>

    <script src="scripts/prettify/prettify.js"> </script>
    <script src="scripts/prettify/lang-css.js"> </script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>

<body>

<div id="main">

    <h1 class="page-title">Class: BlockPyEditor</h1>

    




<section>

<header>
    
        <h2>BlockPyEditor</h2>
        
    
</header>

<article>
    <div class="container-overview">
    
        

    

    <h4 class="name" id="BlockPyEditor"><span class="type-signature"></span>new BlockPyEditor<span class="signature">(main, tag)</span><span class="type-signature"></span></h4>

    



<div class="description">
    An object that manages the various editors, where users can edit their program. Also manages the
movement between editors.
There are currently four editors:
 - Blocks: A Blockly instance
 - Text: A CodeMirror instance
 - Instructor: Features for changing the assignment and environment settings
 - Upload: (Incomplete) A menu for uploading and running code from a desktop file.
</div>







    <h5>This:</h5>
    <ul><li>{<a href="BlockPyEditor.html">BlockPyEditor</a>}</li></ul>



    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>main</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            

            

            <td class="description last">The main BlockPy instance</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>tag</code></td>
            

            <td class="type">
            
                
<span class="param-type">HTMLElement</span>


            
            </td>

            

            

            <td class="description last">The HTML object this is attached to.</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line15">line 15</a>
    </li></ul></dd>
    

    

    

    
</dl>
















    
    </div>

    

    

    

     

    

    
        <h3 class="subsection-title">Members</h3>

        
            
<h4 class="name" id=".CATEGORY_MAP"><span class="type-signature">(static) </span>CATEGORY_MAP<span class="type-signature"></span></h4>




<div class="description">
    Maps short category names in the toolbox to the full XML used to
represent that category as usual. This is kind of a clunky mechanism
for managing the different categories, and doesn't allow us to specify
individual blocks.
</div>







<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line819">line 819</a>
    </li></ul></dd>
    

    

    

    
</dl>






        
            
<h4 class="name" id="previousLine"><span class="type-signature"></span>previousLine<span class="type-signature"></span></h4>










    <h5 class="subsection-title">Properties:</h5>

    

<table class="props">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>previousLine</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">Keeps track of the previously highlighted line.</td>
        </tr>

    
    </tbody>
</table>




<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line643">line 643</a>
    </li></ul></dd>
    

    

    

    
</dl>






        
    

    
        <h3 class="subsection-title">Methods</h3>

        
            

    

    <h4 class="name" id="addAvailableModule"><span class="type-signature"></span>addAvailableModule<span class="signature">(name)</span><span class="type-signature"></span></h4>

    



<div class="description">
    Makes the module available in the availableModules multi-select menu by adding
it to the list.
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>name</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last">The name of the module (human-friendly version, as opposed to the slug) to be added.</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line214">line 214</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="changeProgram"><span class="type-signature"></span>changeProgram<span class="signature">(name)</span><span class="type-signature"></span></h4>

    



<div class="description">
    Updates the current file being edited in the editors.
This appears to be deprecated.
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>name</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last">The name of the file being edited (e.g, "__main__", "starting_code")</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line795">line 795</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="copyImage"><span class="type-signature"></span>copyImage<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Shows a dialog window with the current block workspace encoded as a
downloadable PNG image.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line1090">line 1090</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="getBlocksFromXml"><span class="type-signature"></span>getBlocksFromXml<span class="signature">()</span><span class="type-signature"> &rarr; {XMLDom}</span></h4>

    



<div class="description">
    Helper function for retrieving the current Blockly workspace as
an XML DOM object.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line626">line 626</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        
<div class="param-desc">
    The blocks in the current workspace.
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">XMLDom</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="getHighlightMap"><span class="type-signature"></span>getHighlightMap<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    DEPRECATED, thankfully
Builds up an array indicating the relevant block ID for a given step.
Operates on the current this.blockly instance
It works by injecting __HIGHLIGHT__(id); at the start of every line of code
 and then extracting that with regular expressions. This makes it vulnerable
 if someone decides to use __HIGHLIGHT__ in their code. I'm betting on that
 never being a problem, though. Still, this was a miserable way of accomplishing
 the desired behavior.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line767">line 767</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="getPngFromBlocks"><span class="type-signature"></span>getPngFromBlocks<span class="signature">(callback)</span><span class="type-signature"></span></h4>

    



<div class="description">
    Generates a PNG version of the current workspace. This PNG is stored in a Base-64 encoded
string as part of a data URL (e.g., "data:image/png;base64,...").
TODO: There seems to be some problems capturing blocks that don't start with
statement level blocks (e.g., expression blocks).
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>callback</code></td>
            

            <td class="type">
            
                
<span class="param-type">function</span>


            
            </td>

            

            

            <td class="description last">A function to be called with the results. This function should take two parameters, the URL (as a string) of the generated base64-encoded PNG and the IMG tag.</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line1027">line 1027</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="hideBlockMenu"><span class="type-signature"></span>hideBlockMenu<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Hides the Block tab, which involves shrinking it and hiding the Blockly instance.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line280">line 280</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="hideInstructorMenu"><span class="type-signature"></span>hideInstructorMenu<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Hides the Instructor tab, which shrinking it.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line319">line 319</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="hideSplitMenu"><span class="type-signature"></span>hideSplitMenu<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Hides the Text tab, which involves shrinking it and hiding its CodeMirror too.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line224">line 224</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="hideTextMenu"><span class="type-signature"></span>hideTextMenu<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Hides the Text tab, which involves shrinking it and hiding its CodeMirror too.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line248">line 248</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="hideUploadMenu"><span class="type-signature"></span>hideUploadMenu<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Hides the Upload tab, which shrinking it.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line303">line 303</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="highlightBlock"><span class="type-signature"></span>highlightBlock<span class="signature">(block)</span><span class="type-signature"></span></h4>

    



<div class="description">
    Highlights a block in Blockly. Unfortunately, this is the same as selecting it.
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>block</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">The ID of the block object to highlight.</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line692">line 692</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="highlightError"><span class="type-signature"></span>highlightError<span class="signature">(line)</span><span class="type-signature"></span></h4>

    



<div class="description">
    Highlights a line of code in the CodeMirror instance. This applies the "error" style
which is meant to suggest that a line is wrong.
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>line</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">The line of code to highlight. I think this is zero indexed?</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line677">line 677</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="highlightLine"><span class="type-signature"></span>highlightLine<span class="signature">(line)</span><span class="type-signature"></span></h4>

    



<div class="description">
    Highlights a line of code in the CodeMirror instance. This applies the "active" style
which is meant to bring attention to a line, but not suggest it is wrong.
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>line</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">The line of code to highlight. I think this is zero indexed?</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line662">line 662</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="initBlockly"><span class="type-signature"></span>initBlockly<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Initializes the Blockly instance (handles all the blocks). This includes
attaching a number of ChangeListeners that can keep the internal code
representation updated and enforce type checking.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line79">line 79</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="initInstructor"><span class="type-signature"></span>initInstructor<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Initializes the Instructor tab, which has a number of buttons and menus for
manipulating assignments and the environment. One important job is to register the
SummerNote instance used for editing the Introduction of the assignment.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line185">line 185</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="initText"><span class="type-signature"></span>initText<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Initializes the CodeMirror instance. This handles text editing (with syntax highlighting)
and also attaches a listener for change events to update the internal code represntation.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line138">line 138</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="refreshBlockHighlight"><span class="type-signature"></span>refreshBlockHighlight<span class="signature">(line)</span><span class="type-signature"></span></h4>

    



<div class="description">
    Used to restore a block's highlight when travelling from the code tab. This
uses a mapping between the blocks and text that is generated from the parser.
The parser has stored the relevant line numbers for each block in the XML of the
block. Very sophisticated, and sadly fairly fragile.
TODO: I believe there's some kind of off-by-one error here...
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>line</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">The line of code to highlight. I think this is zero indexed?</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line705">line 705</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="refreshHighlight"><span class="type-signature"></span>refreshHighlight<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Assuming that a line has been highlighted previously, this will set the
line to be highlighted again. Used when we need to restore a highlight.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line649">line 649</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="resetBlockSilence"><span class="type-signature"></span>resetBlockSilence<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Resets the silenceBlock after a short delay
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line576">line 576</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="setBlocksFromXml"><span class="type-signature"></span>setBlocksFromXml<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Helper function for setting the current Blockly workspace to
whatever XML DOM is given. This clears out any existing blocks.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line634">line 634</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="setLevel"><span class="type-signature"></span>setLevel<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Eventually will be used to update "levels" of sophistication of the code interface.
Currently unimplemented and unused.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line809">line 809</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="setMode"><span class="type-signature"></span>setMode<span class="signature">(mode)</span><span class="type-signature"></span></h4>

    



<div class="description">
    Dispatch method to set the mode to the given argument.
If the mode is invalid, an editor error is reported. If the
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>mode</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last">The new mode to set to ("Blocks", "Text", "Upload", or "Instructor")</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line427">line 427</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="setModeToBlocks"><span class="type-signature"></span>setModeToBlocks<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Sets the current editor mode to Blocks, hiding the other menus.
Also forces the block side to update.
There is a chance this could fail, if the text side is irredeemably
awful. So then the editor bounces back to the text side.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line350">line 350</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="setModeToInstructor"><span class="type-signature"></span>setModeToInstructor<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Sets the current editor mode to the Instructor mode, hiding the other menus.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line404">line 404</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="setModeToSplit"><span class="type-signature"></span>setModeToSplit<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Sets the current editor mode to Split mode, hiding the other menus.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line390">line 390</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="setModeToText"><span class="type-signature"></span>setModeToText<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Sets the current editor mode to Text, hiding the other menus.
Also forces the text side to update.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line336">line 336</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="setModeToUpload"><span class="type-signature"></span>setModeToUpload<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Sets the current editor mode to Upload mode, hiding the other menus.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line379">line 379</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="setText"><span class="type-signature"></span>setText<span class="signature">(code)</span><span class="type-signature"></span></h4>

    



<div class="description">
    Actually changes the value of the CodeMirror instance
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>code</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last">The new code for the CodeMirror</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line455">line 455</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="showBlockMenu"><span class="type-signature"></span>showBlockMenu<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Shows the Block tab, which involves restoring its height and showing the Blockly instance.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line290">line 290</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="showInstructorMenu"><span class="type-signature"></span>showInstructorMenu<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Shows the Instructor tab, which involves restoring its height.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line327">line 327</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="showSplitMenu"><span class="type-signature"></span>showSplitMenu<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Shows the Text tab, which requires restoring its height, showing AND refreshing
the CodeMirror instance.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line233">line 233</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="showTextMenu"><span class="type-signature"></span>showTextMenu<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Shows the Text tab, which requires restoring its height, showing AND refreshing
the CodeMirror instance.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line259">line 259</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="showUploadMenu"><span class="type-signature"></span>showUploadMenu<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Shows the Upload tab, which involves restoring its height.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line311">line 311</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="unhighlightBlock"><span class="type-signature"></span>unhighlightBlock<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Removes the outline around a block. Currently unused.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line741">line 741</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="unhighlightLines"><span class="type-signature"></span>unhighlightLines<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Removes any highlight in the text code editor.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line749">line 749</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="updateBlocks"><span class="type-signature"></span>updateBlocks<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Attempts to update the model for the current code file from the 
block workspace. Might be prevented if an update event was already
percolating.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line531">line 531</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="updateBlocksFromModel"><span class="type-signature"></span>updateBlocksFromModel<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>

    



<div class="description">
    Updates the block editor from the current code file in the
model. Might be prevented if an update event was already
percolating. This can also report an error if one occurs.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line609">line 609</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        
<div class="param-desc">
    Returns true upon success.
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Boolean</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="updateTextFromModel"><span class="type-signature"></span>updateTextFromModel<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Updates the text editor from the current code file in the
model. Might be prevented if an update event was already
percolating.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line592">line 592</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="updateToolbox"><span class="type-signature"></span>updateToolbox<span class="signature">(only_set)</span><span class="type-signature"> &rarr; (nullable) {String}</span></h4>

    



<div class="description">
    Creates an updated representation of the Toolboxes XML as currently specified in the
model, using whatever modules have been added or removed. This method can either set it
or just retrieve it for future use.
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>only_set</code></td>
            

            <td class="type">
            
                
<span class="param-type">Boolean</span>


            
            </td>

            

            

            <td class="description last">Whether to return the XML string or to actually set the XML. False means that it will not update the toolbox!</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line964">line 964</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        
<div class="param-desc">
    Possibly returns the XML of the toolbox as a string.
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">String</span>


    </dd>
</dl>

    



        
    

    

    
</article>

</section>




</div>

<nav>
    <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BlockPy.html">BlockPy</a></li><li><a href="BlockPyCorgis.html">BlockPyCorgis</a></li><li><a href="BlockPyDialog.html">BlockPyDialog</a></li><li><a href="BlockPyEditor.html">BlockPyEditor</a></li><li><a href="BlockPyEngine.html">BlockPyEngine</a></li><li><a href="BlockPyEnglish.html">BlockPyEnglish</a></li><li><a href="BlockPyFeedback.html">BlockPyFeedback</a></li><li><a href="BlockPyHistory.html">BlockPyHistory</a></li><li><a href="BlockPyPresentation.html">BlockPyPresentation</a></li><li><a href="BlockPyPrinter.html">BlockPyPrinter</a></li><li><a href="BlockPyServer.html">BlockPyServer</a></li><li><a href="BlockPyToolbar.html">BlockPyToolbar</a></li><li><a href="LocalStorageWrapper.html">LocalStorageWrapper</a></li><li><a href="PythonToBlocks.html">PythonToBlocks</a></li></ul><h3>Global</h3><ul><li><a href="global.html#BlockPyInterface">BlockPyInterface</a></li><li><a href="global.html#cloneNode">cloneNode</a></li><li><a href="global.html#encodeHTML">encodeHTML</a></li><li><a href="global.html#expandArray">expandArray</a></li><li><a href="global.html#EXTENDED_ERROR_EXPLANATION">EXTENDED_ERROR_EXPLANATION</a></li><li><a href="global.html#indent">indent</a></li><li><a href="global.html#instructor_module">instructor_module</a></li><li><a href="global.html#prettyPrintDateTime">prettyPrintDateTime</a></li><li><a href="global.html#randomInteger">randomInteger</a></li><li><a href="global.html#set_button_loaded">set_button_loaded</a></li><li><a href="global.html#timerGuard">timerGuard</a></li></ul>
</nav>

<br class="clear">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Mar 26 2017 09:45:04 GMT-0400 (Eastern Daylight Time)
</footer>

<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>